<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="../00.插件/babel.min.js"></script>
  <script src="../00.插件/react.development.js"></script>
  <script src="../00.插件/react-dom.development.js"></script>
  <script src="../00.插件/prop-types.js"></script>
</head>

<body>

<div id="app"></div>

<script type="text/babel">

  class Parent extends React.Component{
    state = {
      name:'万登豪',
      age:18,
      hobby:'打球'
    }
    render(){
      const {name,age,hobby} = this.state
      return(
        <div>
          姓名：<input type="text" value={name} onChange={this.changeName}/>
          年龄：<input type="text"  value={age} onChange={this.changeAge}/>
          爱好：<input type="text"  value={hobby} onChange={this.changeHobby}/>
          <button onClick={this.handler}>点击获取数据</button>
        </div>
      )

    }
    changeName = (e) =>{
      const {value} = e.target
      console.log(value)
    }
    changeAge = (e) =>{
      const {value} = e.target
      console.log(value)
    }
    changeHobby = (e) =>{
      const {value} = e.target
      console.log(value)
    }

    handler = () =>{


      // console.log(name,age,hobby)
    }

  }

  const root = ReactDOM.createRoot(document.getElementById('app')).render(<Parent/>)
</script>
</body>
</html>